﻿using Sunny.UI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DayuCode.Designer.Forms
{
    public partial class FormFuncType : UIForm
    {
        public static readonly int Page = 1;
        public static readonly int Module = 2;//1页面 2菜单项

        private int funcType = 0;
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sblingOrChild">1 sbling , 2 child</param>
        public FormFuncType(int sblingOrChild)
        {
            InitializeComponent();
            string tip = sblingOrChild == 1 ? "同级" : "下级";
            this.Text = this.Text.Replace("节点", tip + "节点");
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            if(rdoModule.Checked || rdoFunc.Checked)
            {
                if (rdoModule.Checked)
                {
                    funcType = Module;
                }else
                {
                    funcType = Page;
                }
                Close();
                DialogResult = DialogResult.OK;
            }
            else
            {
                ShowWarningTip("请选择要添加的节点的类型");
            }
        }

        /// <summary>
        /// 1页面 2菜单项 FormFuncType.Page FormFuncType.Module
        /// </summary>
        public int FuncType
        {
            get { return funcType; }
        }
    }
}
